
package com.example.xlzx.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.xlzx.dao.PsychologicalNewsMapper;
import com.example.xlzx.entity.PsychologicalNews;

import com.example.xlzx.service.IPsychologicalNewsService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 心理资讯表 服务实现类
 * </p>
 *
 * @author 1
 * @since 2025-03-07
 */
@Service
public class PsychologicalNewsServiceImpl extends ServiceImpl<PsychologicalNewsMapper, PsychologicalNews> implements IPsychologicalNewsService {
    @Override
    public IPage<PsychologicalNews> pagePsychologicalNews(Page<PsychologicalNews> pageParam, String keyword) {
        Page<PsychologicalNews> page = this.lambdaQuery()
                .like(keyword != null, PsychologicalNews::getTitle, keyword)
                .page(pageParam);
        return page;
    }

    @Override
    public boolean insertPsychologicalNews(PsychologicalNews psychologicalNews) {
        return save(psychologicalNews);
    }

    @Override
    public boolean deletePsychologicalNewsById(Long id) {
        return removeById(id);
    }

    @Override
    public boolean updatePsychologicalNews(PsychologicalNews psychologicalNews) {
        return updateById(psychologicalNews);
    }

    @Override
    public PsychologicalNews getPsychologicalNewsById(Long id) {
        return getById(id);
    }
}
